home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / w3d / wire3d.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-04-30  |  27.1 KB  |  893 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "Comdlg32.ocx"
  3. Object = "{82427AF4-E037-11D1-BDEA-000000000000}#1.0#0"; "W3D.ocx"
  4. Begin VB.Form w3Dfrm 
  5.    AutoRedraw      =   -1  'True
  6.    Caption         =   "Wire3D"
  7.    ClientHeight    =   5208
  8.    ClientLeft      =   816
  9.    ClientTop       =   -720
  10.    ClientWidth     =   8076
  11.    Icon            =   "wire3D.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5208
  14.    ScaleWidth      =   8076
  15.    Begin W3D.W3Dctl W3Dctl1 
  16.       Height          =   3504
  17.       Left            =   36
  18.       TabIndex        =   46
  19.       Top             =   36
  20.       Width           =   4260
  21.       _ExtentX        =   7514
  22.       _ExtentY        =   6181
  23.    End
  24.    Begin VB.TextBox Text3 
  25.       Height          =   252
  26.       Left            =   6480
  27.       TabIndex        =   42
  28.       Text            =   "1"
  29.       Top             =   2124
  30.       Width           =   336
  31.    End
  32.    Begin VB.TextBox Text2 
  33.       Height          =   240
  34.       Left            =   6480
  35.       TabIndex        =   40
  36.       Text            =   "1"
  37.       Top             =   1008
  38.       Width           =   336
  39.    End
  40.    Begin VB.CommandButton Command5 
  41.       Caption         =   "a,A,b,B,c,C"
  42.       Height          =   264
  43.       Left            =   2772
  44.       TabIndex        =   37
  45.       Top             =   4860
  46.       Width           =   1500
  47.    End
  48.    Begin VB.CommandButton Command4 
  49.       Caption         =   "z,Z,x,X,y,Y"
  50.       Height          =   264
  51.       Left            =   1260
  52.       TabIndex        =   36
  53.       Top             =   4860
  54.       Width           =   1500
  55.    End
  56.    Begin VB.CommandButton Command6 
  57.       Caption         =   "L,R,U,D"
  58.       Height          =   264
  59.       Left            =   2772
  60.       TabIndex        =   34
  61.       Top             =   4572
  62.       Width           =   1500
  63.    End
  64.    Begin VB.CommandButton Command3 
  65.       Caption         =   "left,right,up,down"
  66.       Height          =   264
  67.       Left            =   1260
  68.       TabIndex        =   33
  69.       Top             =   4572
  70.       Width           =   1500
  71.    End
  72.    Begin VB.CommandButton Command1 
  73.       Caption         =   "add "
  74.       Height          =   228
  75.       Left            =   5652
  76.       TabIndex        =   26
  77.       Top             =   1476
  78.       Width           =   1632
  79.    End
  80.    Begin VB.CommandButton Command2 
  81.       Caption         =   "remove "
  82.       Height          =   228
  83.       Left            =   5652
  84.       TabIndex        =   25
  85.       Top             =   1728
  86.       Width           =   1632
  87.    End
  88.    Begin VB.TextBox Text6 
  89.       Height          =   288
  90.       Index           =   9
  91.       Left            =   5004
  92.       TabIndex        =   24
  93.       Text            =   "0"
  94.       Top             =   2124
  95.       Width           =   516
  96.    End
  97.    Begin VB.TextBox Text6 
  98.       Height          =   288
  99.       Index           =   10
  100.       Left            =   5004
  101.       TabIndex        =   23
  102.       Text            =   "0"
  103.       Top             =   1800
  104.       Width           =   516
  105.    End
  106.    Begin VB.TextBox Text6 
  107.       Height          =   288
  108.       Index           =   11
  109.       Left            =   5004
  110.       TabIndex        =   22
  111.       Text            =   "0"
  112.       Top             =   1476
  113.       Width           =   516
  114.    End
  115.    Begin VB.Frame Frame6 
  116.       Caption         =   "p1"
  117.       Height          =   1236
  118.       Index           =   0
  119.       Left            =   4680
  120.       TabIndex        =   15
  121.       Top             =   108
  122.       Width           =   876
  123.       Begin VB.TextBox Text6 
  124.          Height          =   288
  125.          Index           =   2
  126.          Left            =   252
  127.          TabIndex        =   18
  128.          Text            =   "0"
  129.          Top             =   828
  130.          Width           =   516
  131.       End
  132.       Begin VB.TextBox Text6 
  133.          Height          =   288
  134.          Index           =   1
  135.          Left            =   252
  136.          TabIndex        =   17
  137.          Text            =   "0"
  138.          Top             =   504
  139.          Width           =   516
  140.       End
  141.       Begin VB.TextBox Text6 
  142.          Height          =   288
  143.          Index           =   0
  144.          Left            =   252
  145.          TabIndex        =   16
  146.          Text            =   "0"
  147.          Top             =   180
  148.          Width           =   516
  149.       End
  150.       Begin VB.Label Label2 
  151.          Caption         =   "z="
  152.          Height          =   228
  153.          Index           =   2
  154.          Left            =   72
  155.          TabIndex        =   21
  156.          Top             =   864
  157.          Width           =   192
  158.       End
  159.       Begin VB.Label Label2 
  160.          Caption         =   "y="
  161.          Height          =   228
  162.          Index           =   1
  163.          Left            =   72
  164.          TabIndex        =   20
  165.          Top             =   540
  166.          Width           =   192
  167.       End
  168.       Begin VB.Label Label2 
  169.          Caption         =   "x="
  170.          Height          =   228
  171.          Index           =   0
  172.          Left            =   72
  173.          TabIndex        =   19
  174.          Top             =   216
  175.          Width           =   192
  176.       End
  177.    End
  178.    Begin VB.Frame Frame6 
  179.       Caption         =   "p2"
  180.       Height          =   1236
  181.       Index           =   1
  182.       Left            =   5616
  183.       TabIndex        =   8
  184.       Top             =   108
  185.       Width           =   840
  186.       Begin VB.TextBox Text6 
  187.          Height          =   288
  188.          Index           =   5
  189.          Left            =   252
  190.          TabIndex        =   11
  191.          Text            =   "0"
  192.          Top             =   828
  193.          Width           =   516
  194.       End
  195.       Begin VB.TextBox Text6 
  196.          Height          =   288
  197.          Index           =   4
  198.          Left            =   252
  199.          TabIndex        =   10
  200.          Text            =   "0"
  201.          Top             =   504
  202.          Width           =   516
  203.       End
  204.       Begin VB.TextBox Text6 
  205.          Height          =   288
  206.          Index           =   3
  207.          Left            =   252
  208.          TabIndex        =   9
  209.          Text            =   "0"
  210.          Top             =   180
  211.          Width           =   516
  212.       End
  213.       Begin VB.Label Label2 
  214.          Caption         =   "x="
  215.          Height          =   228
  216.          Index           =   5
  217.          Left            =   72
  218.          TabIndex        =   14
  219.          Top             =   216
  220.          Width           =   192
  221.       End
  222.       Begin VB.Label Label2 
  223.          Caption         =   "y="
  224.          Height          =   228
  225.          Index           =   4
  226.          Left            =   72
  227.          TabIndex        =   13
  228.          Top             =   540
  229.          Width           =   192
  230.       End
  231.       Begin VB.Label Label2 
  232.          Caption         =   "z="
  233.          Height          =   228
  234.          Index           =   3
  235.          Left            =   72
  236.          TabIndex        =   12
  237.          Top             =   864
  238.          Width           =   192
  239.       End
  240.    End
  241.    Begin VB.CommandButton Command11 
  242.       Caption         =   "remove "
  243.       Height          =   228
  244.       Left            =   6480
  245.       TabIndex        =   7
  246.       Top             =   468
  247.       Width           =   800
  248.    End
  249.    Begin VB.CommandButton Command10 
  250.       Caption         =   "add "
  251.       Height          =   228
  252.       Left            =   6480
  253.       TabIndex        =   6
  254.       Top             =   216
  255.       Width           =   800
  256.    End
  257.    Begin VB.PictureBox pCol 
  258.       Appearance      =   0  'Flat
  259.       AutoRedraw      =   -1  'True
  260.       AutoSize        =   -1  'True
  261.       BackColor       =   &H80000005&
  262.       ForeColor       =   &H80000008&
  263.       Height          =   912
  264.       Left            =   5850
  265.       Picture         =   "wire3D.frx":030A
  266.       ScaleHeight     =   888
  267.       ScaleWidth      =   1716
  268.       TabIndex        =   0
  269.       Top             =   2430
  270.       Width           =   1740
  271.    End
  272.    Begin MSComDlg.CommonDialog CommonDialog1 
  273.       Left            =   6912
  274.       Top             =   5976
  275.       _ExtentX        =   699
  276.       _ExtentY        =   699
  277.       _Version        =   327680
  278.    End
  279.    Begin VB.OptionButton Option3 
  280.       Caption         =   "background"
  281.       Height          =   228
  282.       Left            =   4392
  283.       TabIndex        =   3
  284.       Top             =   3276
  285.       Width           =   1344
  286.    End
  287.    Begin VB.OptionButton Option2 
  288.       Caption         =   "point"
  289.       Height          =   192
  290.       Left            =   4392
  291.       TabIndex        =   2
  292.       Top             =   3024
  293.       Width           =   984
  294.    End
  295.    Begin VB.OptionButton Option1 
  296.       Caption         =   "line"
  297.       Height          =   192
  298.       Left            =   4392
  299.       TabIndex        =   1
  300.       Top             =   2736
  301.       Value           =   -1  'True
  302.       Width           =   948
  303.    End
  304.    Begin VB.PictureBox Picture1 
  305.       Appearance      =   0  'Flat
  306.       AutoSize        =   -1  'True
  307.       BackColor       =   &H80000005&
  308.       ForeColor       =   &H80000008&
  309.       Height          =   1512
  310.       Left            =   4320
  311.       Picture         =   "wire3D.frx":802C
  312.       ScaleHeight     =   1488
  313.       ScaleWidth      =   2940
  314.       TabIndex        =   4
  315.       Top             =   3600
  316.       Width           =   2964
  317.    End
  318.    Begin VB.TextBox Text1 
  319.       Appearance      =   0  'Flat
  320.       BackColor       =   &H00C0FFC0&
  321.       Height          =   948
  322.       Left            =   36
  323.       MultiLine       =   -1  'True
  324.       ScrollBars      =   2  'Vertical
  325.       TabIndex        =   5
  326.       Text            =   "wire3D.frx":1E4EE
  327.       Top             =   3600
  328.       Width           =   4230
  329.    End
  330.    Begin VB.CheckBox Check1 
  331.       Caption         =   "tile"
  332.       BeginProperty Font 
  333.          Name            =   "Arial"
  334.          Size            =   7.8
  335.          Charset         =   0
  336.          Weight          =   400
  337.          Underline       =   0   'False
  338.          Italic          =   0   'False
  339.          Strikethrough   =   0   'False
  340.       EndProperty
  341.       ForeColor       =   &H00000000&
  342.       Height          =   156
  343.       Left            =   756
  344.       TabIndex        =   39
  345.       Top             =   4752
  346.       Width           =   768
  347.    End
  348.    Begin VB.Shape Shape2 
  349.       FillStyle       =   0  'Solid
  350.       Height          =   264
  351.       Left            =   6948
  352.       Top             =   1008
  353.       Width           =   336
  354.    End
  355.    Begin VB.Shape Shape3 
  356.       FillStyle       =   0  'Solid
  357.       Height          =   264
  358.       Left            =   6948
  359.       Top             =   2124
  360.       Width           =   336
  361.    End
  362.    Begin VB.Label Label10 
  363.       Caption         =   "color"
  364.       Height          =   192
  365.       Left            =   6912
  366.       TabIndex        =   45
  367.       Top             =   1944
  368.       Width           =   516
  369.    End
  370.    Begin VB.Label Label9 
  371.       Caption         =   "color"
  372.       Height          =   192
  373.       Left            =   6912
  374.       TabIndex        =   44
  375.       Top             =   828
  376.       Width           =   516
  377.    End
  378.    Begin VB.Label Label8 
  379.       Caption         =   "width"
  380.       Height          =   192
  381.       Left            =   6480
  382.       TabIndex        =   43
  383.       Top             =   1944
  384.       Width           =   444
  385.    End
  386.    Begin VB.Label Label7 
  387.       Caption         =   "width"
  388.       Height          =   192
  389.       Left            =   6480
  390.       TabIndex        =   41
  391.       Top             =   828
  392.       Width           =   444
  393.    End
  394.    Begin VB.Label Label1 
  395.       Caption         =   "color"
  396.       BeginProperty Font 
  397.          Name            =   "MS Sans Serif"
  398.          Size            =   7.8
  399.          Charset         =   177
  400.          Weight          =   400
  401.          Underline       =   -1  'True
  402.          Italic          =   0   'False
  403.          Strikethrough   =   0   'False
  404.       EndProperty
  405.       Height          =   192
  406.       Left            =   4320
  407.       TabIndex        =   32
  408.       Top             =   2484
  409.       Width           =   876
  410.    End
  411.    Begin VB.Line Line2 
  412.       X1              =   7272
  413.       X2              =   4284
  414.       Y1              =   2448
  415.       Y2              =   2448
  416.    End
  417.    Begin VB.Line Line1 
  418.       X1              =   7272
  419.       X2              =   4284
  420.       Y1              =   1404
  421.       Y2              =   1404
  422.    End
  423.    Begin VB.Label Label2 
  424.       Caption         =   "z="
  425.       Height          =   228
  426.       Index           =   9
  427.       Left            =   4824
  428.       TabIndex        =   29
  429.       Top             =   2160
  430.       Width           =   192
  431.    End
  432.    Begin VB.Label Label2 
  433.       Caption         =   "y="
  434.       Height          =   228
  435.       Index           =   10
  436.       Left            =   4824
  437.       TabIndex        =   28
  438.       Top             =   1836
  439.       Width           =   192
  440.    End
  441.    Begin VB.Label Label2 
  442.       Caption         =   "x="
  443.       Height          =   228
  444.       Index           =   11
  445.       Left            =   4824
  446.       TabIndex        =   27
  447.       Top             =   1512
  448.       Width           =   192
  449.    End
  450.    Begin VB.Label Label3 
  451.       Caption         =   "line"
  452.       BeginProperty Font 
  453.          Name            =   "MS Sans Serif"
  454.          Size            =   7.8
  455.          Charset         =   177
  456.          Weight          =   400
  457.          Underline       =   -1  'True
  458.          Italic          =   0   'False
  459.          Strikethrough   =   0   'False
  460.       EndProperty
  461.       Height          =   240
  462.       Left            =   4320
  463.       TabIndex        =   30
  464.       Top             =   30
  465.       Width           =   480
  466.    End
  467.    Begin VB.Label Label4 
  468.       Caption         =   "point"
  469.       BeginProperty Font 
  470.          Name            =   "MS Sans Serif"
  471.          Size            =   7.8
  472.          Charset         =   177
  473.          Weight          =   400
  474.          Underline       =   -1  'True
  475.          Italic          =   0   'False
  476.          Strikethrough   =   0   'False
  477.       EndProperty
  478.       Height          =   228
  479.       Left            =   4320
  480.       TabIndex        =   31
  481.       Top             =   1440
  482.       Width           =   696
  483.    End
  484.    Begin VB.Label Label5 
  485.       Caption         =   "XYZ system"
  486.       Height          =   228
  487.       Left            =   36
  488.       TabIndex        =   35
  489.       Top             =   4536
  490.       Width           =   1236
  491.    End
  492.    Begin VB.Label Label6 
  493.       Caption         =   "3D figure"
  494.       Height          =   228
  495.       Left            =   36
  496.       TabIndex        =   38
  497.       Top             =   4932
  498.       Width           =   1560
  499.    End
  500.    Begin VB.Menu File 
  501.       Caption         =   "&File"
  502.       Index           =   1
  503.       Begin VB.Menu mnuLoad 
  504.          Caption         =   "&Load 3D figure"
  505.          Index           =   1
  506.          Begin VB.Menu loadWObounds 
  507.             Caption         =   "with&out saved boundaries"
  508.             Index           =   18
  509.          End
  510.          Begin VB.Menu loadWbounds 
  511.             Caption         =   "&with saved boundaries"
  512.             Index           =   19
  513.          End
  514.       End
  515.       Begin VB.Menu mnuAddFigure 
  516.          Caption         =   "&Add 3D figure"
  517.          Index           =   30
  518.       End
  519.       Begin VB.Menu mnuSave 
  520.          Caption         =   "&Save 3D figure"
  521.          Index           =   3
  522.       End
  523.       Begin VB.Menu mnuBackGroundPicture 
  524.          Caption         =   "Load &Background Picture"
  525.          Index           =   2
  526.       End
  527.       Begin VB.Menu mnuSaveAsPicture 
  528.          Caption         =   "Sa&ve as Picture"
  529.          Index           =   4
  530.       End
  531.       Begin VB.Menu mnuPrint 
  532.          Caption         =   "&Print"
  533.          Index           =   5
  534.       End
  535.       Begin VB.Menu mnuExit 
  536.          Caption         =   "&Exit"
  537.          Index           =   6
  538.       End
  539.    End
  540.    Begin VB.Menu mnuAction 
  541.       Caption         =   "&Action"
  542.       Index           =   7
  543.       Begin VB.Menu mnuClear3Dall 
  544.          Caption         =   "Clear 3D &All"
  545.          Index           =   14
  546.       End
  547.       Begin VB.Menu mnuClearAll3Dlines 
  548.          Caption         =   "Clear 3D &Lines"
  549.          Index           =   10
  550.       End
  551.       Begin VB.Menu mnuClearBackGroundPicture 
  552.          Caption         =   "Clear &Background Picture"
  553.          Index           =   8
  554.       End
  555.       Begin VB.Menu mnuZoom 
  556.          Caption         =   "&Zoom"
  557.          Index           =   11
  558.          WindowList      =   -1  'True
  559.          Begin VB.Menu mnuZoomIn 
  560.             Caption         =   "&In    (  x 2  )"
  561.             Index           =   12
  562.          End
  563.          Begin VB.Menu mnuZoomOut 
  564.             Caption         =   "&Out ( x 0.5 )"
  565.             Index           =   13
  566.          End
  567.       End
  568.    End
  569.    Begin VB.Menu mnuProperties 
  570.       Caption         =   "&Properties"
  571.       Index           =   21
  572.    End
  573. Attribute VB_Name = "w3Dfrm"
  574. Attribute VB_GlobalNameSpace = False
  575. Attribute VB_Creatable = False
  576. Attribute VB_PredeclaredId = True
  577. Attribute VB_Exposed = False
  578. Option Explicit
  579. Dim isPressed As Boolean
  580. Private Sub Command1_Click()
  581.   W3Dctl1.AddPoint3D Val(Text6(11)), Val(Text6(10)), Val(Text6(9)), Val(Text3), Shape3.FillColor
  582. End Sub
  583. Private Sub Command10_Click()
  584.    W3Dctl1.AddLine3D Val(Text6(0)), Val(Text6(1)), Val(Text6(2)), Val(Text6(3)), Val(Text6(4)), Val(Text6(5)), Val(Text2), Shape2.FillColor
  585. End Sub
  586. Private Sub Command11_Click()
  587.   W3Dctl1.RemoveLine3D Val(Text6(0)), Val(Text6(1)), Val(Text6(2)), Val(Text6(3)), Val(Text6(4)), Val(Text6(5)), True
  588. End Sub
  589. Private Sub Command2_Click()
  590.   W3Dctl1.RemovePoint3D Val(Text6(11)), Val(Text6(10)), Val(Text6(9)), True
  591. End Sub
  592. Private Sub Command3_Click()
  593.  Static i As Integer
  594.  Dim j As Double
  595.  i = i + 1
  596.   For j = 1 To 360 Step 10
  597.    Select Case i Mod 4
  598.     Case 1:     W3Dctl1.angle1 = W3Dctl1.angle1 + 10
  599.     Case 2:     W3Dctl1.angle1 = W3Dctl1.angle1 - 10
  600.     Case 3:     W3Dctl1.angle2 = W3Dctl1.angle2 + 10
  601.     Case 0:     W3Dctl1.angle2 = W3Dctl1.angle2 - 10
  602.    End Select
  603.                'change CheckBox "tail" status
  604.    W3Dctl1.Show3D 1 - Check1.Value
  605.    DoEvents
  606.   Next j
  607. End Sub
  608. Private Sub Command4_Click()
  609.  Static i As Integer
  610.  Dim j As Double
  611.   i = i + 1
  612.   For j = 1 To 360 Step 10
  613.    Select Case i Mod 6
  614.     Case 1:     W3Dctl1.rotateByZaxe 10
  615.     Case 2:     W3Dctl1.rotateByZaxe -10
  616.     Case 3:     W3Dctl1.rotateByXaxe 10
  617.     Case 4:     W3Dctl1.rotateByXaxe -10
  618.     Case 5:     W3Dctl1.rotateByYaxe 10
  619.     Case 0:     W3Dctl1.rotateByYaxe -10
  620.    End Select
  621.                'change CheckBox "tail" status
  622.    W3Dctl1.Show3D 1 - Check1.Value
  623.    DoEvents
  624.   Next j
  625. End Sub
  626. Private Sub Command5_Click()
  627. Static i As Integer
  628.   i = i + 1
  629.   Select Case i Mod 6
  630.     Case 1:     W3Dctl1.vector 2, 0, 0
  631.     Case 2:     W3Dctl1.vector 0, 2, 0
  632.     Case 3:     W3Dctl1.vector 0, 0, 2
  633.     Case 4:     W3Dctl1.vector -2, 0, 0
  634.     Case 5:     W3Dctl1.vector 0, -2, 0
  635.     Case 0:     W3Dctl1.vector 0, 0, -2
  636.   End Select
  637.                'change CheckBox "tail" status
  638.    W3Dctl1.Show3D 1 - Check1.Value
  639. End Sub
  640. Private Sub Command6_Click()
  641.  Static i As Integer
  642.    i = i + 1
  643.    W3Dctl1.SetFocus
  644.    Select Case i Mod 4
  645.     Case 1:     W3Dctl1.showVector -1, 0
  646.     Case 2:     W3Dctl1.showVector 1, 0
  647.     Case 3:     W3Dctl1.showVector 0, 1
  648.     Case 0:     W3Dctl1.showVector 0, -1
  649.    End Select
  650.                'change CheckBox "tail" status
  651.    W3Dctl1.Show3D 1 - Check1.Value
  652. End Sub
  653. Private Sub loadWbounds_Click(Index As Integer)
  654.   W3Dctl1.ClearAll3D
  655.   LoadFigure True
  656. End Sub
  657. Private Sub loadWObounds_Click(Index As Integer)
  658.   W3Dctl1.ClearAll3D
  659.   LoadFigure False
  660. End Sub
  661. Private Sub mnuAddFigure_Click(Index As Integer)
  662.   LoadFigure False
  663. End Sub
  664. Private Sub mnuBackGroundPicture_Click(Index As Integer)
  665.   On Error GoTo eee
  666.    CommonDialog1.CancelError = True
  667.    CommonDialog1.Filter = "Pictures (*.bmp;*.dib;*.gif;*.jpg;*.wmf;*.emf)|*.bmp;*.bmp;*.dib;*.gif;*.jpg;*.wmf;*.emf"
  668.    CommonDialog1.filename = ""
  669.    CommonDialog1.ShowOpen
  670.    If CommonDialog1.FileTitle = "" Then Exit Sub
  671.    W3Dctl1.PictureFileName = CommonDialog1.filename
  672.    mnuClearBackGroundPicture.Item(8).Enabled = True
  673. End Sub
  674. Private Sub LoadFigure(withSavedBounds As Boolean)
  675.   On Error GoTo eee
  676.    CommonDialog1.CancelError = True
  677.    CommonDialog1.Filter = "Graphs (*.grh)|*.grh"
  678.    CommonDialog1.filename = ""
  679.    CommonDialog1.ShowOpen
  680.    If CommonDialog1.FileTitle = "" Then Exit Sub
  681.    If withSavedBounds Then
  682.       W3Dctl1.LoadFigure CommonDialog1.filename, True
  683.    Else
  684.       W3Dctl1.LoadFigure CommonDialog1.filename
  685.    End If
  686. End Sub
  687. Private Sub mnuClear3Dall_Click(Index As Integer)
  688.    W3Dctl1.ClearAll3D
  689. End Sub
  690. Private Sub mnuClearAll3Dlines_Click(Index As Integer)
  691.    W3Dctl1.ClearAll3Dsegments
  692. End Sub
  693. Private Sub mnuClearBackGroundPicture_Click(Index As Integer)
  694.    W3Dctl1.PictureFileName = ""
  695.    mnuClearBackGroundPicture.Item(8).Enabled = False
  696. End Sub
  697. Private Sub mnuProperties_Click(Index As Integer)
  698.   With wproperties
  699.     .txtXmin = W3Dctl1.Xmin
  700.     .txtXmax = W3Dctl1.Xmax
  701.     .txtYmin = W3Dctl1.Ymin
  702.     .txtYmax = W3Dctl1.Ymax
  703.     .txtZmin = W3Dctl1.Zmin
  704.     .txtZmax = W3Dctl1.Zmax
  705.    If W3Dctl1.isPerspective Then
  706.       .Option2.Value = 1
  707.    Else
  708.       .Option1.Value = 1
  709.    End If
  710.    If W3Dctl1.SelectLineByMouse Then
  711.       .CheckLines.Value = 1
  712.    Else
  713.       .CheckLines.Value = 0
  714.    End If
  715.    If W3Dctl1.SelectPointByMouse Then
  716.       .CheckPoints.Value = 1
  717.    Else
  718.       .CheckPoints.Value = 0
  719.    End If
  720.    If W3Dctl1.show3Daxes Then
  721.       .Checkshow3Daxes.Value = 1
  722.    Else
  723.       .Checkshow3Daxes.Value = 0
  724.    End If
  725.    If W3Dctl1.show3DaxesNames Then
  726.       .CheckAxesNames.Value = 1
  727.    Else
  728.       .CheckAxesNames.Value = 0
  729.    End If
  730.    If W3Dctl1.show3Dboundaries Then
  731.       .Checkshow3Dbound.Value = 1
  732.    Else
  733.       .Checkshow3Dbound.Value = 0
  734.    End If
  735.    If W3Dctl1.drawXYZproportional2Ranges Then
  736.       .CheckXYZproportional.Value = 1
  737.    Else
  738.       .CheckXYZproportional.Value = 0
  739.    End If
  740.    If W3Dctl1.show3DplaneXY Then
  741.       .CheckShow3DplaneXY.Value = 1
  742.    Else
  743.       .CheckShow3DplaneXY.Value = 0
  744.    End If
  745.   End With
  746.   With W3Dctl1
  747.    oldXmin = .Xmin
  748.    oldXmax = .Xmax
  749.    oldYmin = .Ymin
  750.    oldYmax = .Ymax
  751.    oldZmin = .Zmin
  752.    oldZmax = .Zmax
  753.    OldshowIsPerspective = .isPerspective
  754.    Oldshow3DplaneXY = .show3DplaneXY
  755.    oldshow3Dboundaries = .show3Dboundaries
  756.    olddrawXYZproportional2Ranges = .drawXYZproportional2Ranges
  757.    oldshow3Daxes = .show3Daxes
  758.    oldshow3DaxesNames = .show3DaxesNames
  759.    oldSelectPointByMouse = .SelectPointByMouse
  760.    oldSelectLineByMouse = .SelectLineByMouse
  761.   End With
  762.   wproperties.Show vbModal
  763. End Sub
  764. Private Sub Form_Load()
  765.  Randomize
  766.  isPressed = False
  767.  TW_X = Screen.TwipsPerPixelX
  768.  TW_Y = Screen.TwipsPerPixelY
  769.  With W3Dctl1
  770.   Shape2.FillColor = .LineColor
  771.    '.Xmin = -40
  772.    '.Xmax = 10
  773.    '.Ymin = -10
  774.    '.Ymax = 10
  775.    '.Zmin = -10
  776.    '.Zmax = 10
  777.    '.show3Dboundaries = True
  778.    '.drawXYZproportional2Ranges = True
  779.    '.show3Daxes = True
  780.    '.LineColor = vbBlue
  781.    '.isPerspective = False
  782.  End With
  783.  pCol.Left = Picture1.Left + Picture1.width - pCol.width
  784.  pCol.Top = Line2.y1 + (Picture1.Top - Line2.y1 - pCol.Height) / 2
  785.  Line2.x1 = pCol.Left + pCol.width - TW_X
  786.  Height = Picture1.Top + Picture1.Height + (GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYCAPTION) + 2 * GetSystemMetrics(SM_CYFRAME) + 4) * TW_Y
  787.  width = Picture1.Left + Picture1.width + (2 * GetSystemMetrics(SM_CXFRAME) + 4) * TW_X
  788.  Top = (Screen.Height - Height) / 2
  789.  Left = (Screen.width - width) / 2
  790.  Dim yy As Integer
  791.  yy = Picture1.Top + Picture1.Height
  792.  Command4.Top = yy - Command4.Height
  793.  Command5.Top = yy - Command5.Height
  794.  Label6.Top = yy - Label6.Height
  795.  yy = yy - Command5.Height - TW_Y
  796.  Command3.Top = yy - Command3.Height
  797.  Command6.Top = yy - Command6.Height
  798.  Label5.Top = yy - Label5.Height
  799.  yy = yy - Command3.Height - 2 * TW_Y
  800.  Text1.Height = yy - Text1.Top
  801.  Check1.Top = Label6.Top + (Label5.Top + Label5.Height - Label6.Top - Check1.Height) / 2
  802.  mnuClearBackGroundPicture.Item(8).Enabled = False
  803. End Sub
  804. Private Sub mnuExit_Click(Index As Integer)
  805.    Unload Me
  806. End Sub
  807. Private Sub mnuPrint_Click(Index As Integer)
  808.   W3Dctl1.PrintImage
  809. End Sub
  810. Private Sub mnuSave_Click(Index As Integer)
  811.   Dim i As Integer
  812.   On Error GoTo aaa
  813.    CommonDialog1.CancelError = True
  814.    CommonDialog1.Filter = "Graphs (*.grh)|*.grh"
  815.    CommonDialog1.filename = ""
  816.    CommonDialog1.ShowSave
  817.    If CommonDialog1.FileTitle = "" Then Exit Sub
  818.    W3Dctl1.SaveFigure CommonDialog1.filename
  819. End Sub
  820. Private Sub mnuSaveAsPicture_Click(Index As Integer)
  821.   On Error GoTo aaa
  822.    CommonDialog1.CancelError = True
  823.    CommonDialog1.Filter = "Picture (*.bmp)|*.bmp|"
  824.    CommonDialog1.filename = ""
  825.    CommonDialog1.ShowSave
  826.    If CommonDialog1.FileTitle = "" Then Exit Sub
  827.    W3Dctl1.SaveImage CommonDialog1.filename
  828. End Sub
  829. Private Sub mnuZoomIn_Click(Index As Integer)
  830.     W3Dctl1.Zoom 0.5
  831.     W3Dctl1.Show3D True
  832. End Sub
  833. Private Sub mnuZoomOut_Click(Index As Integer)
  834.     W3Dctl1.Zoom 2
  835.     W3Dctl1.Show3D True
  836. End Sub
  837. Private Sub pCol_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
  838.  On Error Resume Next
  839.   isPressed = True
  840.   If Option1.Value = True Then
  841.        Shape2.FillColor = pCol.Point(x, y)
  842.        W3Dctl1.LineColor = Shape2.FillColor
  843.   End If
  844.   If Option2.Value = True Then Shape3.FillColor = pCol.Point(x, y)
  845.   If Option3.Value = True Then W3Dctl1.BackColor = pCol.Point(x, y)
  846. End Sub
  847. Private Sub pCol_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
  848.  On Error Resume Next
  849.   If isPressed Then
  850.     If Option1.Value = True Then
  851.        Shape2.FillColor = pCol.Point(x, y)
  852.        W3Dctl1.LineColor = Shape2.FillColor
  853.     End If
  854.     If Option2.Value = True Then Shape3.FillColor = pCol.Point(x, y)
  855.     If Option3.Value = True Then W3Dctl1.BackColor = pCol.Point(x, y)
  856.   End If
  857. End Sub
  858. Private Sub pCol_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  859.  On Error Resume Next
  860.   If isPressed Then
  861.     If Option1.Value = True Then
  862.        Shape2.FillColor = pCol.Point(x, y)
  863.        W3Dctl1.LineColor = Shape2.FillColor
  864.     End If
  865.     If Option2.Value = True Then Shape3.FillColor = pCol.Point(x, y)
  866.     If Option3.Value = True Then W3Dctl1.BackColor = pCol.Point(x, y)
  867.     isPressed = False
  868.   End If
  869. End Sub
  870. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
  871.   KeyCode = 0
  872. End Sub
  873. Private Sub Text1_KeyPress(KeyAscii As Integer)
  874.   KeyAscii = 0
  875. End Sub
  876. Private Sub W3Dctl1_LineSelected(x1 As Double, y1 As Double, z1 As Double, x2 As Double, y2 As Double, z2 As Double, width As Integer, color As Long)
  877.   Text6(0) = x1
  878.   Text6(1) = y1
  879.   Text6(2) = z1
  880.   Text6(3) = x2
  881.   Text6(4) = y2
  882.   Text6(5) = z2
  883.   Text2 = width
  884.   Shape2.FillColor = color
  885. End Sub
  886. Private Sub W3Dctl1_PointSelected(x As Double, y As Double, z As Double, width As Integer, color As Long)
  887.   Text6(11) = x
  888.   Text6(10) = y
  889.   Text6(9) = z
  890.   Text3 = width
  891.   Shape3.FillColor = color
  892. End Sub
  893.